package grep_demo

import (
	"context"
	"google.golang.org/grpc"
	"net"
)

func Main() {
	grpcListener, err := net.Listen("tcp", ":8888")
	if err != nil {
		panic(err)
	}
	g := grpc.NewServer()

	RegisterAddServer(g, NewGRPCServer(func(ctx context.Context, request interface{}) (response interface{}, err error) {
		req := request.(*SumRequest)
		return &SumReply{V: req.B + req.A, Err: ""}, nil
	}))
	err = g.Serve(grpcListener)
	if err != nil {
		panic(err)
	}
}
